<%@page import="java.util.List"%>
<%@page import="cn.com.dao.DepartmentsDao"%>
<%@page import="cn.com.entity.Departments"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
body{
color: #03C;
}

</style>
<script type="text/javascript">
function shanchu(){
		var queren=confirm("确认要删除吗");
		if(queren!=true){
			return false;
		}
}

</script>
</head>
<body>
<%if(session.getAttribute("manager")!=null){ %>
<center><h2>科室管理</h2></center>
<form action="adddepartmentsaction" method="post">
<center>${departmentsmsg}</center>
<table align="center" width="80%" border="1">
	<tr align="left"><td colspan="3">您当前所在位置-->科室管理</td></tr>
	<tr >
		<td>科室名：<input type="text" name="departments.departmentsname" value=""/></td>
		<td>科室简介：<textarea rows="2" cols="20" name="departments.departmentsprofile"></textarea></td>
		<td>科室位置：<textarea rows="2" cols="20" name="departments.departmentsposition"></textarea></td>
	</tr>
	<tr><td align="center" colspan="3"><input type="submit" style="font-size:20px; color:#FFF; background-image: url(images/lanseanniu.jpg);" value="添 加 "/></td></tr>
</table>
</form>
<br/><br/>

<table align="center" width="80%" border="1">
	<tr>
		<td>科室名称</td>
		<td>科室简介</td>
		<td>科室位置</td>
		<td>修改</td>
		<td>删除</td>
	</tr>
<%
List<Departments> list=(List<Departments>)session.getAttribute("departmentslist");
if(list!=null){
	for(int i=0;i<list.size();i++){
		Departments departments=list.get(i);
%>	
	<tr>
		<td><%=departments.getDepartmentsname()%></td>
		<td><%=departments.getDepartmentsprofile()%></td>
		<td><%=departments.getDepartmentsposition()%></td>
		<td><a href="updatedepartments.jsp?departid=<%=departments.getDepartmentsid()%>" target="_self">修改</a></td>
		<td><a href="deletedepartmentsaciton?departments.departmentsid=<%=departments.getDepartmentsid()%>" onclick="return shanchu()" >删除</a></td>
	</tr>
<%}
}%>	
</table>
<%} 
else{
	response.sendRedirect("managerlogin.jsp");
	
}
%>
</body>
</html>